/*
 * si2c.h
 *
 * softwaire i2c driver.
 *
 * Copyright (C) 2022 Microwell, Inc.
 * Subject to the GNU Public License, version 2.
 *
 * Author: guoming<guoming@microwell.net>
 */
#ifndef __SI2C_H__
#define __I2C_H__

#include "core.h"
/*
 * Software I2C I/O definition, for example:
 * 0x01 stands for P01, 0x13 stands for P13.
 */
#define IIC_CLK             (0x11)
#define IIC_DAT             (0x12)

#if (CONFIG_USING_SI2C > 0)
void si2c_master_init(void);
void si2c_master_exit(void);
int8_t si2c_master_write(uint8_t device_addr, uint8_t device_reg, uint8_t val);
int16_t si2c_master_read(uint8_t device_addr, uint8_t device_reg);
#else
#define si2c_master_init()
#define si2c_master_exit()
#define si2c_master_write(device_addr, device_reg, val)
#define si2c_master_read(device_addr, device_reg) (0)
#endif

#endif